import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
const router = new Router({
  routes: [
    {
      path: '/',
      name: 'left',
      component: () => import('@/components/left'),
      children:[
        {
          path:'/',
          name:'domain',
          meta: { 
            token: true,
            title:'综合平台'
          },
          component: () => import('@/components/domain.vue'),
        },
        {
          path:'/healthlist',
          name:'healthlist',
          meta: { 
            token: true,
            title:'电子健康卡管理'
          },
          component: () => import('@/components/health/list.vue'),
        },
        {
          path:'/healthcreate',
          name:'healthcreate',
          meta: { 
            token: true,
            title:'健康卡注册(申领)'
          },
          component: () => import('@/components/health/create.vue'),
        },
        {
          path:'/content',
          name:'healthcreate',
          meta: { 
            token: true,
            title:'健康卡注册(申领)'
          },
          component: () => import('@/components/health/content.vue'),
        },
        {
          path:'/hospitaldata',
          name:'hospitaldata',
          meta: { 
            token: true,
            title:'健康卡注册(申领)'
          },
          component: () => import('@/components/health/hospitaldata.vue'),
        }
      ]
    }
  ]
})
// router.beforeEach((to, from, next) => {
//   if (to.matched.some(res => res.meta.token)) {
//     if (store.state.token !== '') {
//       next()
//     } else {
//       next({
//         path: '/login',
//       })
//     }
//   } else {
//     next()
//   }
// })
export default router